<template>
	<div class="commit-footer">
		<div class="left-countbox" v-if="showFooter">
			<div class="left-count">
				<div class="top">
					共 &nbsp; <i> {{historyLabelNo.length + notScanLabelNo.length + count.length}}</i> 票
				</div>
				<!-- <div class="top">
					已扫描数量:<i> {{historyLabelNo.length}}</i>件
				</div>
				<div class="bottom">
					当前扫描:<i>{{ count.length }}</i>件
				</div> -->
			</div>
			<div class="commit-button-box">
				<!-- <div v-if='orderListScanned.length < 1 || (orderListScanned.length == 1 && orderListScanned[0].flag != "package") '
					class="commit-button BatchCommit" @click='BatchCommit'>批量提交</div> -->
				<div class="commit-button" :class='{checkForCommit:hideBitch}' @click="checkForCommit2">提交</div>
			</div>
			<!-- <v-confirm ref="myConfirm" @userBehavior="userBehaviorFun"></v-confirm> -->
		</div>
		<div v-if="ifTips" class="msg_tips">
			<div class="tips_content">
				<i class="iconfont icon-chenggong1"></i>
				<p>{{tips_Msg}}</p>
			</div>
		</div>
	</div>
</template>
<script>
	import {
        aviationOutPortSubmitScan,
        aviationOutPortBatchSubmitScan
	} from "../api/api";
	import Confirm from '../components/confirm'
	import $ from 'jquery'
	export default {
		name: "commit-footer",
		components: {
			'v-confirm': Confirm
		},
		data() {
			return {
				tips_Msg: '',
				ifTips: false,
                docmHeight: document.documentElement.clientHeight,  // 默认屏幕高度       
                realHeight:  0, // 实时屏幕高度 
                showFooter: true, // 显示底部fixed
				CurrentCity: '', // 当前城市
				CurrentLocation: '', // 当前地址
				CurrentDistrict: '', // 当前区县
				BatchCommitNumber: '', // 批量提交数量
				longitude: '',
				latitude: '',
				crruentconfirm: "", // 是提交还是批量提交
				AllCommitPopUp_show: false, // 提交前 全部扫描 提示弹出框
				BatchOrderNum: 0, // 批量提交时，当前订单总件数
				BatchOrderLastNum: 0 // 批量提交时，当前订单 上次提交的数量
			}
		},
		props: [
			"type",
		    'project',
			'address',
			'count', // 运单数量
			'orderCount', // 订单数量
			'countData',
			'orderList',
			'deliveryId',
			'hideBitch',
			'transportLinks', // 扫描环节
			'actualQty', // 订单总件数
			'orderId', // 订单id
			'AbHasScanNum', // 异常已签收数量
			'yiScanNumber', // 上次已扫描数量
			'scanned', // 历史列表
			'notScanned', // 未扫描标签列表
			'orderListScanned', // 已扫描标签列表
			'OMSNum', // 订单数量
			'historyLabelNo', // 历史标签列表
			'notScanLabelNo' // 未扫描标签列表
        ],
        watch: {
            realHeight:function() {
                // 如果默认高度大于实际高度则影藏，反之就显示
				if (this.docmHeight > this.realHeight) {            
					this.showFooter = false        
				} else {            
					this.showFooter = true        
				}
            }
        },
		mounted() {
			let CurrentLocationInfo = this.Geolocation('positionInfo');
			// this.onPlusReady('e') // 获取APP经纬度
			this.CurrentCity = this.$store.state.CurrentCity
			this.CurrentDistrict = this.$store.state.CurrentDistrict
			this.CurrentLocation= this.$store.state.CurrentLocation
			this.latitude = this.$store.state.latitude
			this.longitude = this.$store.state.longitude
            window.onresize = ()=>{
                return(()=>{                     
                    // 实时屏幕高度                       
                    this.realHeight = document.body.clientHeight         
                })()    
            } 
		},
		methods: {
			// 刷新定位
			RefreshPositioning() {
				this.onPlusReady('e') // 获取APP经纬度
			},
			SetCurrAddress(lngad) {
				this.ReceivingLatitud(lngad);
			},
			// 判断路由，提货扫描以及签收扫描弹出弹窗  
			checkForCommit2 () {
				let omsNoArr = []
				this.orderListScanned.map(item => {
					omsNoArr.push({'omsNo': item.omsNo, 'labelNo': item.labelNo, 'orderId': item.id, 'loc': item.loc})
				})
				let that = this
				let params = { 
					"abnormalReason": this.type,
					"omsNoArray": omsNoArr,
					"project": this.project
				}
				that.httpRequest1('post', '/system/app/reportAbnormalBatch', params,'isLoading_').then(res => {
					if (res.success) {
						that.ifTips = true;
						that.tips_Msg = '提交成功';
						that.$emit('reflash', true)
						setTimeout(function () {
							that.ifTips = false;
						}, 1500)
					}
				})
			},
		}
	}
</script>
<style scoped lang="less">
	@import "publicLess.less";
	.SelectDelivery {
		.DeliveryBox {
			padding-top: 30/50rem;
			.commitPopUp_head {
				height: 50/50rem;
				line-height: 50/50rem;
			}
		}
	}
</style>